package sy.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonProperty;
@Entity
@Table(name = "iot_entranceuri_project_mapping", catalog = "ssh")
public class IotEntranceURIProjectMapping implements java.io.Serializable {
	private Integer id;
	private IotEntranceURI iotEntranceURI;
	private SysProject sysProject;
	private String remarks;
	
	@JsonProperty(value = "iotEntranceURIName")
    private String iotEntranceURIName;
	
	@JsonProperty(value = "sysProjectName")
    private String sysProjectName;
	
	public IotEntranceURIProjectMapping() {
		super();
	}
	
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "iotEntranceURI")
	public IotEntranceURI getIotEntranceURI() {
		return iotEntranceURI;
	}

	public void setIotEntranceURI(IotEntranceURI iotEntranceURI) {
		this.iotEntranceURI = iotEntranceURI;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "sysProject")
	public SysProject getSysProject() {
		return sysProject;
	}

	public void setSysProject(SysProject sysProject) {
		this.sysProject = sysProject;
	}
	@Column(name = "remarks")
	public String getRemarks() {
		return remarks;
	}
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	@Transient
	public String getIotEntranceURIName() {
		return getIotEntranceURI().getUri();
	}

	public void setIotEntranceURIName(String iotEntranceURIName) {
		this.iotEntranceURIName = iotEntranceURIName;
	}

	@Transient
	public String getSysProjectName() {
		return getSysProject().getName();
	}

	public void setSysProjectName(String sysProjectName) {
		this.sysProjectName = sysProjectName;
	}
	
	
}
